<template>
  <div @click="shuaxin()">
      <img :src="this.test" alt="图片加载失败">
  </div>
</template>

<script>
import axios from 'axios'
export default {
    data(){
        return{
            test:''
        }
    },
    methods:{   
        shuaxin(){
            axios({
                url:"http://127.0.0.1:8000/myapp/mycode/",
                method:'get',
                responseType: 'blob',
            }).then(res=>{
                this.test  = window.URL.createObjectURL(res.data);
                //src 就是一个可以显示图片的相对路径。因为window.URL.crateObjectURL(blob)已经进行了转换
            })
        }
    },
    created(){
        this.shuaxin()
    }
}
</script>

<style>

</style>